export const toStringMatch = (data: string, decimal = 6) => {
    if (data) {
        if (decimal == 2) {
            return Number(data.toString().match(/^\d+(?:\.\d{0,2})?/));
        } else {
            return Number(data.toString().match(/^\d+(?:\.\d{0,6})?/));
        }

    } else {
        return 0;
    }
}

export const formatAddress = (address: string, dynamic = 6) => {
    if (address) {
        var subStr1 = address.substr(0, 6);
        var subStr2 = address.substr(
            address.length - dynamic,
            dynamic
        );
        var subStr = subStr1 + "..." + subStr2;
        return subStr;
    } else {
        return "";
    }
}